package com.souche.employment.controller;

import com.souche.employment.CommonUtils;
import com.souche.employment.domain.FollowDO;
import com.souche.employment.mapper.FollowMapper;
import com.souche.employment.response.DataResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * BaseController.java created at 2017年8月8日 下午1:11:20
 *
 * @author Ray [email:rayinhangzhou@hotmail.com]
 * Revision History
 * Date            Programmer                   Notes
 * ----------------------------------------------------------
 **/

@RestController
@RequestMapping(value = "/follow")
@Api(value = "/follow", description = "跟进接口")
public class FollowController {
    @Autowired
    private FollowMapper followMapper;


    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加跟进")
    public DataResult add(
            @RequestParam String employeeId,
            @RequestParam String content,
            @RequestParam(required = false) String nextFollow) {
        FollowDO followDO = new FollowDO();
        followDO.setId(CommonUtils.getShortUuid());
        followDO.setEmployeeId(employeeId);
        followDO.setContent(content);
        followDO.setNextFollow(CommonUtils.parseDate(nextFollow, "yyyy-MM-dd HH:mm"));
        followMapper.add(followDO);
        return DataResult.success(null);
    }


}
